<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=8"><!--以IE8模式渲染-->
	<meta http-equiv="X-UA-Compatible" content="IE=7"><!--以IE7模式渲染-->
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<title>用户新增</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/long_add.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/easyuiTab/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/easyuiTab/icon.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery.alert.v1.2/jquery.alert.css"/>
	<script type="text/javascript" src="__PUBLIC__/js/easyuiTab/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/easyuiTab/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.alert.v1.2/jquery.alert.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/ajax.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>

	<script type="text/javascript">
		function visitlogSubmit() 
		{
			if(nameValidate() & addressValidate() & typeValidate() & circleValidate() & personValidate() & phoneValidate() & visittypeValidate() & returntaskValidate()) 
			{
				$("#investForm").submit();
			}
		}

		//	商户名称验证
		function nameValidate() 
		{
			var value = $("#visitlog_name").val();
			if(value == null || value == '') 
			{
				jAlert("商户名称不能为空！", '错误提示', null);
				return false;
			}
			else if(value.length >= 45)
			{
				jAlert("商户名称超过最大字符限制！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	商户地址验证
		function addressValidate() 
		{
			var value = $("#visitlog_address").val();
			if(value == null || value == '') 
			{
				jAlert("商户地址不能为空！", '错误提示', null);
				return false;
			}
			else if(value.length >= 145)
			{
				jAlert("商户地址超过最大字符限制！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	商户类型验证
		function typeValidate() 
		{
			var value = $("#businesstype_id").val();
			if(value == null || value == '') 
			{
				jAlert("商户类型不能为空！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	所属商圈验证
		function circleValidate() 
		{
			var value = $("#circle_id").val();
			if(value == null || value == '') 
			{
				jAlert("所属商圈不能为空！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	负责人姓名验证
		function personValidate() 
		{
			var value = $("#visitlog_person").val();
			if(value == null || value == '') 
			{
				jAlert("负责人姓名不能为空！", '错误提示', null);
				return false;
			}
			else if(value.length >= 45)
			{
				jAlert("负责人姓名超过最大字符限制！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	联系电话验证
		function phoneValidate() 
		{
			var value = $("#visitlog_phone").val();
			if(value == '' || value == null) 
			{
				jAlert("联系电话不能为空！",'错误提示',null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	拜访方式验证
		function visittypeValidate() 
		{
			var value = $("#visitlog_type").val();
			if(value == null || value == '') 
			{
				jAlert("拜访方式不能为空！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	预计回访日期验证
		function returndateValidate() 
		{
			var value = $("#visitlogdetail_returndate").val();
			if(value == null || value == '') 
			{
				jAlert("预计回访日期不能为空！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}

		//	预计回访任务验证
		function returntaskValidate() 
		{
			var value = $("#visitlogdetail_returntask").val();
			if(value == null || value == '') 
			{
				jAlert("预计回访任务不能为空！", '错误提示', null);
				return false;
			}
			else if(value.length >= 145)
			{
				jAlert("预计回访任务超过最大字符限制！", '错误提示', null);
				return false;
			}
			else
			{
				return true;
			}
		}
	</script>
</head>
<body>
	<div class="contentPage">
		<form action="../../facilitator/visitlog/visitlog_add" method="post" id="investForm">
			<table class="addForm">
				<tr>
					<th><span>*</span>商户名称：</th>
					<td>
						<input type="text" name="visitlog_name" id="visitlog_name">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>商户地址：</th>
					<td>
						<input type="text" name="visitlog_address" id="visitlog_address">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>商户类型：</th>
					<td>
						<select name="businesstype_id" id="businesstype_id">
							<option value=''>请选择</option>
							<?php 
								foreach ($array_businesstype as $key => $value) 
								{
									echo '<option value="'.$value['id'].'">'.$value['name'].'</option>';
								}
							?>
						</select>
						<span id="typeSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>所属商圈：</th>
					<td>
						<select name="circle_id" id="circle_id">
							<option value=''>请选择</option>
							<?php 
								foreach ($array_circle as $key => $value) 
								{
									echo '<option value="'.$value['circle_id'].'">'.$value['circle_name'].'</option>';
								}
							?>
						</select>
						<span id="typeSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>负责人姓名：</th>
					<td>
						<input type="text" name="visitlog_person" id="visitlog_person">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>联系电话：</th>
					<td>
						<input type="text" name="visitlog_phone" id="visitlog_phone">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>拜访方式：</th>
					<td>
						<select name="visitlog_type" id="visitlog_type">
							<option value=''>请选择</option>
							<option value='1'>主动拜访</option>
							<option value='2'>商户联系</option>
						</select>
						<span id="typeSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>拜访结果：</th>
					<td>
						<input type="text" name="visitlogdetail_result" id="visitlogdetail_result">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>预计回访日期</th>
					<td>
						<input type="text" class="easyui-datebox" id="visitlogdetail_returndate" name="visitlogdetail_returndate" data-options="formatter:myformatter,parser:myparser,editable:false" value="{$array.visitlogdetail_returndate}">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<th><span>*</span>预计回访任务</th>
					<td>
						<input type="text" name="visitlogdetail_returntask" id="visitlogdetail_returntask">
						<span id="titleSpan"></span>
					</td>
				</tr>

				<tr>
					<td colspan="2" class="addButton">
						<input type="hidden" id="loadNameFlag">
						<input type="button" value="保存" class="save" onclick="visitlogSubmit();">
						<input type="reset" value="重置" class="clear"></td>
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>